import { ColumnProps } from "@/components/ProTable/interface";
import {jumpTypeEnum, statusEnum} from "@/config/enums/serviceDict";

export function advertise(spaceList: any[]) {
  const columns: ColumnProps[] = [
    { type: "selection", fixed: "left", width: 80 },
    { type: "index", label: "#", width: 80 },
    // { type: "expand", label: "Expand", width: 100 },
    {
      prop: "image_url",
      label: "广告图",
      width: 150,
    },
    {
      prop: "title",
      label: "广告标题",
      width: 180,
      search: { el: "input", props: { placeholder: "广告标题", style: "width: 180px;" } }
    },
    {
      prop: "space_id",
      label: "广告位",
      width: 150,
      enum: spaceList,
      fieldNames: {
        label: "name",
        value: "id",
      },
      search: { el: "select", props: { placeholder: "请选择广告位", style: "width: 150px;" } }
    },
    {
      prop: "jump_type",
      label: "跳转类型",
      width: 100,
      enum: jumpTypeEnum,
      search: { el: "select", props: { placeholder: "跳转类型", style: "width: 100px;" } }
    },
    {
      prop: "jump_page",
      label: "跳转页面",
      width: 150,
    },
    {
      prop: "jump_param",
      label: "参数",
      width: 150,
    },
    {
      prop: "remark",
      label: "备注",
      width: 200
    },
    {
      prop: "sort",
      label: "排序",
      width: 150
    },
    {
      prop: "status",
      label: "状态",
      width: 100,
      enum: statusEnum,
      search: { el: "select", props: { placeholder: "状态", style: "width: 100px;" } }
    },
    {
      prop: "create_time",
      label: "创建时间",
      width: 180,
      search: {
        el: "date-picker",
        key: "dateTimeRange",
        props: { type: "datetimerange", valueFormat: "YYYY-MM-DD HH:mm:ss", clearable: true, style: "width: 240px;" }
      }
    },
    { prop: "operation", label: "操作", fixed: "right", width: 240 }
  ];
  return { columns };
}
